﻿using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using System.IO;
using System.Runtime.InteropServices;
using System.Threading;
 
using Tao;
using Tao.OpenGl;
using VoltGameEditor.Properties;
using WeifenLuo.WinFormsUI.Docking;

namespace VoltGameEditor
{
    public partial class StartPage : DockContentEx
    {
		public StartPage()
        {
            InitializeComponent();
			this.docType = Globals.DocType.StartPage;
        }

		private void button1_Click(object sender, EventArgs e)
        {
			if (!(Globals.NumDocs < Globals.MaxOpenDocs))
			{
				MessageBox.Show("Due to possible large memory usage, only " + Globals.MaxOpenDocs + " documents are allowed open at one time.", "Exclamation", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
				return; 
			}

            

			Framework.CreateMap("Untitled" + (Globals.NumDocs + 1).ToString());
			
            Program.mainWin.Menu_Layout.Visible = true;
			Program.mainWin.ts_status.Visible = true;

            functions.ShowToolboxes();
            AppSettings.LoadMapSettings(Globals.GameMode);
        }

		private void StartPage_Load(object sender, EventArgs e)
		{
			foreach (var s in AppSettings.General.RecentFiles)
			{
				tree_recent.Nodes.Add(s);
			}
		}

		private void tree_recent_NodeMouseDoubleClick(object sender, TreeNodeMouseClickEventArgs e)
		{
			if (tree_recent.SelectedNode != null)
			{
				MessageBox.Show("NodeDoubleClicK", "Placeholder for code...");
			}
		}
    }
}
